<include file="Public/header" />

<div class="feeldesk" id="formWrapper">

    <header>

        <div class="menu-header">

            <a href="javascript:history.go(-1)" class="iconfont icon-back-left back"></a>

            <div class="header-title">{:L('MODIFY_CUSTOMER')}</div>

            <a href="javascript:" class="header-right" id="submitForm">{:L('COMPLETE')}</a>

        </div>

    </header>

    <div class="feeldesk-main no-footer-main pd0">

		<php>
			$ft = 0;
			$reg = 0;
		</php>

        <form action="{:U('edit',['id'=>encrypt($customer['customer_id'],'CUSTOMER'),'detailtype'=>encrypt($detailtype,'CUSTOMER')])}" id="feeldeskForm" method="post" class="layui-form">

            <div class="feeldesk-form pd5">

				<notempty name="isUpdateTradeAuth">

				<div class="feeldesk-form-item relative">

					<div class="feeldesk-form-block">

						<div class="feeldesk-input feeldesk-form-check radio name-radio"><span>{:L('TRANSACTION_STATUS')}</span><i class="feeldesk-edge"></i></div>

						<ul class="feeldesk-option-panel radioPanel hidden">

							<input type="hidden" name="customer[is_trade]" value="{$customer.is_trade}"/>

							<li data-name="{:L('UNSOLD')}" data-value="0">

								<div class="feeldesk-option">

									<span class="feeldesk-option-title">{:L('UNSOLD')}</span>

									<span class="iconfont icon-check <if condition="!$customer['is_trade'] || $customer['is_trade'] === '0'">icon-radio-checked</if>"></span>

								</div>

							</li>

							<li data-name="{:L('DEAL_DONE')}" data-value="1">

								<div class="feeldesk-option">

									<span class="feeldesk-option-title">{:L('DEAL_DONE')}</span>

									<span class="iconfont icon-check <eq name='customer[is_trade]' value='1' >icon-radio-checked</eq>"></span>

								</div>

							</li>

						</ul>

					</div>

				</div>

				</notempty>

				<if condition="$crmsite['customerReseller'] == 1">

				<div class="feeldesk-form-item relative">

					<div class="feeldesk-form-block">

						<span class="red required-icon">*</span>

						<div class="feeldesk-input feeldesk-form-check radio name-radio"><span>{:L('CUSTOMER_TYPE')}</span><i class="feeldesk-edge"></i></div>

						<ul class="feeldesk-option-panel radioPanel hidden">

							<input type="hidden" name="customer[customer_type]" value="<notempty name='customer.customer_type'>{$customer.customer_type}<else/>customer</notempty>"/>

							<li data-name="{:L('ORDINARY_CUSTOMER')}" data-value="customer">

								<div class="feeldesk-option">

									<span class="feeldesk-option-title">{:L('ORDINARY_CUSTOMER')}</span>

									<span class="iconfont icon-check <if condition="!$customer['customer_type'] || $customer['customer_type'] =='customer'">icon-radio-checked</if>"></span>

								</div>

							</li>

							<li data-name="{:L('DEALER')}" data-value="agent">

								<div class="feeldesk-option">

									<span class="feeldesk-option-title">{:L('DEALER')}</span>

									<span class="iconfont icon-check <eq name='customer[customer_type]' value='agent' >icon-radio-checked</eq>"></span>

								</div>

							</li>

						</ul>

					</div>

                </div>

				</if>

                <volist name="customerform" id="vo">

				<!-- 字段未设置查看范围或当前用户角色在查看范围内 -->
				<if condition="!$vo['role_id'] || in_array($mobile['role_id'],explode(',',$vo['role_id']))">

				<!-- 字段未设置编辑权限或当前用户在编辑权限内 -->
				<if condition="!$vo['member_id'] || in_array($mobile['member_id'],explode(',',$vo['member_id']))">

					<eq name="vo.form_type" value="region">

						<php>
							$reg++;
						</php>

						{:W('Region/getRegionEdit',['customer_form',$vo,$reg,$customer])}

					<else/>

					 <div class="feeldesk-form-item relative">

						<div class="feeldesk-form-block">

							<eq name="vo.is_required" value="0">

								<span class="red required-icon">*</span>

							</eq>

							<eq name="vo.form_type" value="text">

								<!-- 单行文本框 -->
								<input type="text" name="customer_form[{$vo.form_name}]" value="{$customer[$vo['form_name']]}" placeholder="{$vo.form_description}" class="feeldesk-input"/>

							</eq>

							<eq name="vo.form_type" value="phone">

								<!-- 手机 -->
								<input type="text" onKeyPress="if (event.keyCode!=46 && event.keyCode!=45 && event.keyCode<48 || event.keyCode>57) event.returnValue=false" name="customer_form[{$vo.form_name}]" value="{$customer[$vo['form_name']]}" placeholder="{$vo.form_description}" class="feeldesk-input"/>

							</eq>

							<eq name="vo.form_type" value="email">

								<!-- 邮箱 -->
								<input type="text" name="customer_form[{$vo.form_name}]" value="{$customer[$vo['form_name']]}" placeholder="{$vo.form_description}" class="feeldesk-input"/>

							</eq>

							<eq name="vo.form_type" value="number">

								<!-- 数字 -->
								<input type="number" onKeyPress="if (event.keyCode!=46 && event.keyCode!=45 && event.keyCode<48 || event.keyCode>57) event.returnValue=false" name="customer_form[{$vo.form_name}]" value="{$customer[$vo['form_name']]}" placeholder="{$vo.form_description}" class="feeldesk-input"/>

							</eq>

							<eq name="vo.form_type" value="decimal">

								<!-- 小数 -->
								<input type="text" name="customer_form[{$vo.form_name}]" value="{$customer[$vo['form_name']]}" placeholder="{$vo.form_description}" class="feeldesk-input"/>

							</eq>

							<eq name="vo.form_type" value="select">

								<!-- 下拉菜单 -->
								<select name="customer_form[{$vo.form_name}]" lay-filter="">

									<option value="">{$vo.form_description}</option>

									<foreach name="vo.option" item="op">

										<option value="{$op}" <eq name="customer[$vo[form_name]]" value="$op" >selected</eq>>{$op}</option>

									</foreach>

								</select>

							</eq>

							<eq name="vo.form_type" value="select_text">

								<php>
									$st++;
								</php>
								<!-- 下拉填写 -->
								{:W('Update/selectTextForm',['customer',$vo,$st,$customer])}

							</eq>

							<eq name="vo.form_type" value="checkbox">

								<!-- 多选 -->
								<div class="feeldesk-input feeldesk-form-check checkbox">

									<span class='gray9'>{$vo.form_description}</span>

									<i class="feeldesk-edge"></i>

								</div>

								<ul class="feeldesk-option-panel hidden checkboxPanel">

									<volist name="vo.option" id="op">

										<li data-value="{$op}">

											<input type="checkbox" name="customer_form[{$vo.form_name}][]" <in name="op" value="$customer[$vo[form_name]]">checked</in> value="{$op}"/>

											<div class="feeldesk-option">

												<span class="feeldesk-option-title">{$op}</span>

												<span class="iconfont icon-check <in name="op" value="$customer[$vo[form_name]]">icon-checkbox-checked</in>"></span>

											</div>

										</li>

									</volist>

								</ul>

							</eq>

							<eq name="vo.form_type" value="radio">

								 <!-- 单选 -->
								<div class="feeldesk-input feeldesk-form-check radio name-radio"><span>{$vo.form_description}</span><i class="feeldesk-edge"></i></div>

								<ul class="feeldesk-option-panel radioPanel hidden">

									<input type="hidden" name="customer_form[{$vo.form_name}]" value="{$customer[$vo['form_name']]}"/>

									<volist name="vo.option" id="op">

									<li data-name="{$op}" data-value="{$op}">

										<div class="feeldesk-option">

											<span class="feeldesk-option-title">{$op}</span>

											<span class="iconfont icon-check <eq name='customer[$vo[form_name]]' value='$op' >icon-radio-checked</eq>"></span>

										</div>

									</li>

									</volist>

								</ul>

							</eq>

							<!-- 文本域 -->
							<eq name="vo.form_type" value="textarea">

								<textarea name="customer_form[{$vo.form_name}]" class="feeldesk-input feeldesk-textarea" placeholder="{$vo.form_description}">{$customer[$vo['form_name']]}</textarea>

							</eq>

							<!-- 时间控件 -->
							<eq name="vo.form_type" value="date">

								<php>
									$ft++;
								</php>

								<input type="text" name="customer_form[{$vo.form_name}]" value="{$customer[$vo['form_name']]}" placeholder="{$vo.form_description}" id="datetime<php>echo $ft;</php>" class="feeldesk-input" readonly />

								<script type="text/javascript">

									$(function()
									{
										jeDate("#datetime<php>echo $ft;</php>",{
											minDate:"1900-01-01",              //最小日期
											maxDate:"2099-12-31",              //最大日期
											method:{
												choose:function (params) {

												}
											},
											format: "YYYY-MM-DD hh:mm:ss"
										});
									})

								</script>

							</eq>

						</div>

					</div>

					</eq>
				<else/>

					<eq name="vo.form_type" value="region">

						<input type="hidden" name="customer_form[{$vo.form_name}_defaultCountry]" value="{$customer[$vo['form_name']]['defaultCountry']}" >
						<input type="hidden" name="customer_form[{$vo.form_name}_defaultProv]" value="{$customer[$vo['form_name']]['defaultProv']}" >
						<input type="hidden" name="customer_form[{$vo.form_name}_defaultCity]" value="{$customer[$vo['form_name']]['defaultCity']}" >
						<input type="hidden" name="customer_form[{$vo.form_name}_defaultArea]" value="{$customer[$vo['form_name']]['defaultArea']}" >

						<else/>

						<input type="hidden" name="customer_form[{$vo.form_name}]" value="{$customer[$vo['form_name']]}" >

					</eq>

				</if>

				<else/>

					<eq name="vo.form_type" value="region">

						<input type="hidden" name="customer_form[{$vo.form_name}_defaultCountry]" value="{$customer[$vo['form_name']]['defaultCountry']}" >
						<input type="hidden" name="customer_form[{$vo.form_name}_defaultProv]" value="{$customer[$vo['form_name']]['defaultProv']}" >
						<input type="hidden" name="customer_form[{$vo.form_name}_defaultCity]" value="{$customer[$vo['form_name']]['defaultCity']}" >
						<input type="hidden" name="customer_form[{$vo.form_name}_defaultArea]" value="{$customer[$vo['form_name']]['defaultArea']}" >

						<else/>

						<input type="hidden" name="customer_form[{$vo.form_name}]" value="{$customer[$vo['form_name']]}" >

					</eq>

				</if>
				</volist>

            </div>

        </form>

    </div>

</div>
